/// This file creates the raw data outputs for Figure 1. The graphs are created 
/// by the file Figures.R. It also contains calculations for Beta values 
/// mentioned in the text.


use "Study1_clean.dta", clear



*** Generate data for Figure 1 (Human Trafficking Attitudes for Republicans, Study 1) 

set more off
mat results = J(2,4,0)
local a=1
local b=1
foreach var of varlist problemR concernR{
reg `var' treat if rep == 1, robust
	mat results[`a',1] = _b[treat]
	mat results[`a',2] = _se[treat]
	mat results[`a',3] = `a'
	mat results[`a',3] = 1
	mat results[`a',4] = `b'
	local ++a
	local ++b
	}
mat2txt, matrix(results) saving(fig1a) replace 

*** Generate data for Figure 1 (Human Trafficking Attitudes for Democrats, Study 1)

set more off
mat results = J(2,4,0)
local a=1
local b=1
foreach var of varlist problemR concernR{
reg `var' treat if rep == 0, robust
	mat results[`a',1] = _b[treat]
	mat results[`a',2] = _se[treat]
	mat results[`a',3] = `a'
	mat results[`a',3] = 1
	mat results[`a',4] = `b'
	local ++a
	local ++b
	}
mat2txt, matrix(results) saving(fig2a) replace 


**** Study 1 Concern for Human Trafficking (mentioned in text) 
ttest concernR if rep == 0, by(treat)
ttest concernR if rep == 1, by(treat)
ttest concernR if treat !=., by(rep)



*** Study 1 Scope of Trafficking Problem (mentioned in the text):
use "Study1_clean.dta", clear

ttest problemR if rep == 0, by(treat)
ttest problemR if rep == 1, by(treat)
ttest problemR if treat !=., by(rep)



*** Generate data for Figure 1 (Human Trafficking Attitudes for Republicans, Study 2) 

use "Study2_clean.dta", clear

set more off
mat results = J(6,4,0)
local a=1
local b=1
foreach var of varlist problemR concernR{
reg `var' treat22 treat23 treat24 trump if rep == 1, robust
	mat results[`a',1] = _b[treat22]
	mat results[`a',2] = _se[treat22]
	mat results[`a',3] = `a'
	mat results[`a',3] = 1
	mat results[`a',4] = `b'
	local ++a
	mat results[`a',1] = _b[treat23]
	mat results[`a',2] = _se[treat23]
	mat results[`a',3] = `a'
	mat results[`a',3] = 2
	mat results[`a',4] = `b'
	local ++a
	mat results[`a',1] = _b[treat24]
	mat results[`a',2] = _se[treat24]
	mat results[`a',3] = `a'
	mat results[`a',3] = 3
	mat results[`a',4] = `b'
	local ++a
	local ++b
	}
mat2txt, matrix(results) saving(fig1) replace 


*** Generate data for Figure 1 (Human Trafficking Attitudes for Democrats, Study 2) 

set more off
mat results = J(6,4,0)
local a=1
local b=1
foreach var of varlist problemR concernR{
reg `var' treat22 treat23 treat24 trump if rep == 0, robust
	mat results[`a',1] = _b[treat22]
	mat results[`a',2] = _se[treat22]
	mat results[`a',3] = `a'
	mat results[`a',3] = 1
	mat results[`a',4] = `b'
	local ++a
	mat results[`a',1] = _b[treat23]
	mat results[`a',2] = _se[treat23]
	mat results[`a',3] = `a'
	mat results[`a',3] = 2
	mat results[`a',4] = `b'
	local ++a
	mat results[`a',1] = _b[treat24]
	mat results[`a',2] = _se[treat24]
	mat results[`a',3] = `a'
	mat results[`a',3] = 3
	mat results[`a',4] = `b'
	local ++a
	local ++b
	}
mat2txt, matrix(results) saving(fig2) replace 

